package com.jackiechancinema.ssm.controller;

import com.jackiechancinema.ssm.bo.PerfBo;
import com.jackiechancinema.ssm.entity.Perf;
import com.jackiechancinema.ssm.service.Inte.PerfService;
import com.jackiechancinema.ssm.vo.PageVo;
import com.jackiechancinema.ssm.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;


@Controller
@ResponseBody
public class PerfController {
    @Autowired
    private PerfService perfService;

    //查询page列表查询
    @RequestMapping("/page/Perf/preflook")
    public PageVo<Perf> queryAll(PerfBo pageBo) {
        return perfService.queryAll(pageBo);
    }
    @RequestMapping("/page/Perf/prefsave")
    public R save(Perf perf){
        System.out.println(perf);
        return perfService.insert(perf);
    }
    @RequestMapping("/page/Perf/prefdelete")
    public R save(int perf_id){
        return perfService.delete(perf_id);
    }
    //编辑用户信息
    @RequestMapping("/page/Perf/prefupdate")
    public R update(Perf perf){
        return perfService.update(perf);
    }
    //批量添加
    @RequestMapping("/page/Perf/batchadd")
    public R batch(MultipartFile file){
        System.out.println(file.getSize());
        return perfService.batchAdd(file);
    }
//    下载导出excel表格
    @RequestMapping("/page/Perf/downperf")
    public void downPerf(PerfBo bo, HttpServletResponse response){
        System.out.println(1);
        perfService.exportExcel(bo,response);
    }
}
